var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("GameData"),
    i = (t("main"), t("Util")),
    s = t("View"),
    c = t("Platforms"),
    l = t("Sounds"),
    u = t("ConfS"),
    p = t("fightManager"),
    f = t("guide"),
    d = t("mate"),
    h = t("selectchapter"),
    y = t("topBar"),
    g = t("warehouse"),
    v = require("./送金刚"),
    m = require("./送金刚领取"),
    _ = cc._decorator,
    A = _.ccclass,
    b =
    (_.property,
        (function(t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (e.res = "mainView"), e;
            }
            var o;
            return (
                n(e, t),
                (o = e),
                (e.prototype.onEnable = function() {
                    this.showView(y.default).buttonActive(!0), l.Sounds.playMusic("背景音乐");
                    var t = [
                        11001, 13002, 15001, 16001, 96001, 17001, 18001, 98001, 19001, 99001, 20001, 22001, 23001,
                        25001, 26001
                    ];
                    if (
                        ((function() {
                                var e = !1;
                                return (
                                    t.forEach(function(t) {
                                        var o = t + 119e6;
                                        a.default.所有已完成的引导.includes(o) && (e = !0);
                                    }),
                                    e
                                );
                            })() &&
                            (a.default.所有已完成的引导.push(99999),
                                (a.default.所有已完成的引导 = a.default.所有已完成的引导)),
                            f.default.isRuning ||
                            this.has_guide() ||
                            !a.default.newData ||
                            (a.default.所有已完成的引导.push(99999),
                                (a.default.所有已完成的引导 = a.default.所有已完成的引导)),
                            c.default.进入主界面(),
                            a.default.setStore(),
                            f.default.isRuning)
                    )
                        this.find("送金刚").active = !1;
                    else {
                        if (
                            (0 == a.default.送金刚启动时间 &&
                                0 == a.default.送金刚是否完成 &&
                                ((a.default.送金刚启动时间 = Date.now()), this.showView(v.default)),
                                0 == a.default.送金刚是否完成)
                        )
                            (Date.now() - a.default.送金刚启动时间) / 1e3 >= u.DatasManager.金刚礼包时长 &&
                            (a.default.送金刚是否完成 = !0);
                        this.find("送金刚").active = !a.default.送金刚是否完成;
                    }
                }),
                (e.prototype.onDisable = function() {
                    c.default.离开主界面();
                }),
                (e.prototype.has_guide = function() {
                    var t = i.check_guide();
                    return !!t && ((this.showView(f.default).set引导数据.value = t), !0);
                }),
                (e.prototype.onClick = function(t) {
                    switch (t) {
                        case "warehouse":
                            this.hideView(o), this.showView(g.default);
                            break;
                        case "pve":
                            (p.default.ispvp = !1), this.hideView(), this.showView(h.default);
                            break;
                        case "pvp":
                            (p.default.ispvp = !0), this.hideView(), this.showView(d.default);
                            break;
                        case "送金刚":
                            a.default.送金刚广告次数 >= u.DatasManager.金刚礼包看视频次数 ?
                                this.showView(m.default) :
                                this.showView(v.default);
                    }
                }),
                (e = o = r([A], e))
            );
        })(s.default));
o.default = b;